use reqwest::Error;

/**
 * 阻塞式 get
 */
#[allow(dead_code)]
pub fn block_get(url: &str) -> Result<String, Error> {
    //let url = "http://smarthse.51vip.biz:8900/wit2/dtu/playSound?deviceId=1&index=3";
    reqwest::blocking::get(url).unwrap().text()
    
}

/**
 * 阻塞式 post json数据
 */
#[allow(dead_code)]
pub fn block_post_json(url: &str, json: &String) -> Result<String, Error> {
    let client = reqwest::blocking::Client::new();
    client.post(url).body(json.clone()).send().unwrap().text()
}